package net.esj.basic.plugins.struts2.message;

import java.util.List;
import java.util.ResourceBundle;

import org.springframework.context.i18n.LocaleContext;

import com.opensymphony.xwork2.util.ValueStack;

/**
 * 该接口重新定义了{@link com.opensymphony.xwork2.TextProvider}的实现
 * 将class或bundlename改成入参。时原来的原型设计改成单例
 * @author Administrator
 *
 */
public interface MessageProvider extends LocaleContext{

    boolean hasKey(Class clazz,String key);
    
    boolean hasKey(String bundleName,String key);

    String getText(Class clazz,String key);
    
    String getText(String bundleName,String key);

 
    String getText(Class clazz,String key, String defaultValue);
    
    String getText(String bundleName,String key, String defaultValue);


    String getText(Class clazz,String key, String defaultValue, String obj);
    
    String getText(String bundleName,String key, String defaultValue, String obj);


    String getText(Class clazz,String key, List<?> args);
    
    String getText(String bundleName,String key, List<?> args);


    String getText(Class clazz,String key, Object... args);
    
    String getText(String bundleName,String key, Object... args);


    String getText(Class clazz,String key, String defaultValue, List<?> args);
    
    String getText(String bundleName,String key, String defaultValue, List<?> args);

    
    String getText(Class clazz,String key, String defaultValue, Object... args);
    
    String getText(String bundleName,String key, String defaultValue, Object... args);

    String getText(Class clazz,String key, String defaultValue, List<?> args, ValueStack stack);
    
    String getText(String bundleName,String key, String defaultValue, List<?> args, ValueStack stack);
    
    String getText(Class clazz,String key, String defaultValue, ValueStack stack, Object... args);
    
    String getText(String bundleName,String key, String defaultValue, ValueStack stack, Object... args);

    ResourceBundle getTexts(String bundleName);

    /**
     * 设置是否每次加载时都重新reload资源
     * @param flag
     */
    void setReloadBundleEveryTime(boolean flag);
}
